<template>
    <div class="hotTopic">
        <van-nav-bar title="热门话题" left-text="返回" left-arrow fixed @click-left="onClickLeft" />
        <div class="content">
            <div class="item" v-for="(item,index) in list" :key="index" @click="toTopicdetail(item.id)">
                <div class="item-left">
                    <img :src="item.cover_image" alt="">
                </div>
                <div class="item-right">
                    <div class="title">{{item.name}}</div>
                    <div class="aaaa">{{item.content_count}}篇笔记</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name:'HotTopic',
        data(){
            return{
                list:[]
            }
        },
        created(){
            this.getaaa()
        },
        methods:{
            onClickLeft(){
                this.$router.go(-1)
            },
            getaaa(){
                this.axios({
                    method:'get',
                    url:'https://apis.netstart.cn/douguo/note/topiclist/0/20'
                }).then(r=>{
                    this.list = r.data.result.list
                })
            },
            toTopicdetail(id){
                this.$router.push({name:'Topicdetail',query:{id}})
            }
        }
    }
</script>

<style lang="less" scoped>
.hotTopic{
    /deep/.van-nav-bar__content{
        padding-top: 30px;
        background-color: #fbb705;
    }
    /deep/.van-nav-bar__left{
        top: 30px;
    }
    /deep/.van-icon, /deep/.van-nav-bar__text{
        color: #fff;
    }
    .content{
        position: fixed;
        top: 76px;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 10px;
        overflow-y: auto;
        .item{
            width: calc(100% - 20px);
            background-color: #fff;
            border-radius: 5px;
            padding: 10px;
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            .item-left{
                margin-right: 15px;
                img{
                     width: 90px;
                height: 60px;
                border-radius: 5px;
                }
            }
            .item-right{
                .title{
                    font-size: 13px;
                    margin: 3px 0;
                }
                .aaaa{
                    font-size: 10px;
                    color: #999;
                    margin: 3px 0;
                }
            }
        }
    }
}
</style>